<form class="layui-form" method="post">
    <div class="layui-form-item" style="padding-top: 2%">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <if condition="$updateone['m_email']">
                <div class="layui-input layui-input80 " style="border: none">{$updateone['m_email']}</div>
                <else/>
                <input type="text" name="email" lay-verify="required|email" maxlength="64"  placeholder="请输入邮箱" autocomplete="off"  id="username" class="layui-input layui-input80">
            </if>
            <img src="__PUBLIC__/Images/help.gif" class="tips_img" title="邮箱注册之后不能修改">
        </div>
    </div>
    <if condition="$updateone['m_email']">
        <div class="layui-form-item">
            <label class="layui-form-label">密码重置</label>
            <div class="layui-input-block">
                <input type="checkbox" name="pwdreset" lay-text="yes|no"  lay-skin="switch">
                <img src="__PUBLIC__/Images/help.gif" class="tips_img" title="重置密码为{$member_info['defaultpwd']}">
            </div>
        </div>
        <else/>
        <div class="layui-form-item">
            <label class="layui-form-label">登录密码</label>
            <div class="layui-input-inline">
                <input type="password" name="password" lay-verify="pass" maxlength="20" placeholder="请输入密码" autocomplete="off" id="pwd" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">重复密码</label>
            <div class="layui-input-inline">
                <input type="password" name="regPwd" lay-verify="regPwd" maxlength="20" placeholder="请再次输入密码" autocomplete="off" id="regPwd" class="layui-input">
            </div>
        </div>
    </if>
    <div class="layui-form-item">
        <label class="layui-form-label">用户状态</label>
        <div class="layui-input-block">
            <input type="checkbox" name="usersattus" lay-text="开启|关闭" <if condition="$updateone['m_status'] eq 1">checked</if> lay-skin="switch">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="user">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>

    form.render();
    form.verify({
        regPwd: function(value){
            var pwd = $("#pwd").val();
            if(!new RegExp(pwd).test(value)) {
                return '两次输入的密码不一致';
            }
            return;
        },
        pass: [
            /^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])).{6,18}$/
            ,'密码必须6到12位，大小写字母数字组合'
        ],
    });
    form.on('submit(user)', function(data){
        var userInfo = data.field;
        var url = "__SELF__";
        $.post(url,userInfo,function(data){
            if(data.code == '4001'){
                layer.msg(data.msg,{icon: 5});
                return;
            }else if(data.code == '101'){
                layer.msg(data.msg, {
                    icon: 6,
                    time: 2000
                }, function(){
                    location.reload();
                });
            }
        });

        return false;
    });

</script>